package tools

import "crypto/sha256"
import "golang.org/x/crypto/ripemd160"

/**
 *@author:zhengyilong
 *@email:1797344574@qq.com
 *@phone:13479394730
 *@DateTime:2022/2/21 9:25
 **/

/**
计算哈希值	sha256
 */
func GetHash(data []byte) []byte{
	hash := sha256.New()  //创建一个sha256的对象
	hash.Write(data)
	return hash.Sum(nil)
}

//进行ripemd160计算
func Ripemd160(data []byte)[]byte {
	hash := ripemd160.New()
	hash.Write(data)
	return hash.Sum(nil)
}